﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MediaRecommender.Model;

namespace MediaRecommender.Controller
{
    //Relays request from view to model, made so program complies with MVC
    //Is not implented in view 
    //is currently not in use!
    public class FriendListController
    {
        private UserCollection _userCollection = UserCollection.Instance;
        private List<User> _userFriendList;

        public List<User> UserFriendList
        {
            get { return this._userFriendList; }
            private set { this._userFriendList = value; }
        }

        public void AddFriend(User friend)
        {
            if (!this.UserFriendList.Contains(friend))
            {
                this.UserFriendList.Add(friend);
            }
        }

        public void AddFriend(string friend)
        {
            User user = UserCollection.Instance.GetUser(friend);

            if (!this.UserFriendList.Contains(user))
            {
                this.UserFriendList.Add(user);
            }
        }

        public FriendListController(User user)
        {
            UserFriendList = UserCollection.Instance.GetUser(user.Name).Friends;
        }
    }
}